package cn.chinaflame.pagodas.utils.LightAlgo;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Queue;

import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.jdbc.core.JdbcTemplate;

import com.alibaba.fastjson.JSONArray;
import com.google.common.collect.Lists;

import cn.chinaflame.pagodas.vo.LightVO;


public class LightUtil {
	
    public static final String AREA01 = "01";//区号
    public static final String AREA02 = "02";//区号
    public static final String AREA03 = "03";//区号
    public static final String AREA04 = "04";//区号
    public static final String AREA05 = "05";//区号
    public static final String AREA06 = "06";//区号
    public static final String AREA07 = "07";//区号
    public static final String AREA08 = "08";//区号
    public static final String AREA09 = "09";//区号
    public static final String AREA10 = "10";//区号
    public static final String AREA11 = "11";//区号
    public static final String AREA12 = "12";//区号
    public static final String AREA13 = "13";//区号
    public static final String AREA14 = "14";//区号
    public static final String SEAT = "01";//座号
    public static final String SEAT02 = "02";//座号
    public static final String SEAT03 = "03";//座号
    public static final String SEAT04 = "04";//座号
  //  public static final String PILLAR = "02";//柱号
    public static final Integer MAXLAYER = 100;//最大层数
    public static final Integer MAXCOL = 100;//最大位数
    public static final ArrayList<String> SEARCHLIGHTS1= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS2= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS3= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS4= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS5= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS6= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS7= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS8= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS9= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS10= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS11= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS12= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS13= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS14= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS15= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS16= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS17= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS18= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS19= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS20= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS21= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS22= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS23= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS24= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS25= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS26= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS27= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS28= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS29= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS30= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS31= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS32= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS33= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS34= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS35= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS36= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS37= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS38= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS39= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS40= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS41= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS42= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS43= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS44= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS45= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS46= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS47= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS48= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS49= Lists.newArrayList();
    public static final ArrayList<String> SEARCHLIGHTS50= Lists.newArrayList();
    public static final ArrayList<ArrayList<String>> SEARCHLIGHTS = new ArrayList<ArrayList<String>>() {//要在多个线程中执行的寻灯灯号
		private static final long serialVersionUID = -3279557658855022662L;

	{
    	add(SEARCHLIGHTS1);
    	add(SEARCHLIGHTS2);
    	add(SEARCHLIGHTS3);
    	add(SEARCHLIGHTS4);
    	add(SEARCHLIGHTS5);
    	add(SEARCHLIGHTS6);
    	add(SEARCHLIGHTS7);
    	add(SEARCHLIGHTS8);
    	add(SEARCHLIGHTS9);
    	add(SEARCHLIGHTS10);
    	add(SEARCHLIGHTS11);
    	add(SEARCHLIGHTS12);
    	add(SEARCHLIGHTS13);
    	add(SEARCHLIGHTS14);
    	add(SEARCHLIGHTS15);
    	add(SEARCHLIGHTS16);
    	add(SEARCHLIGHTS17);
    	add(SEARCHLIGHTS18);
    	add(SEARCHLIGHTS19);
    	add(SEARCHLIGHTS20);
    	add(SEARCHLIGHTS21);
    	add(SEARCHLIGHTS22);
    	add(SEARCHLIGHTS23);
    	add(SEARCHLIGHTS24);
    	add(SEARCHLIGHTS25);
    	add(SEARCHLIGHTS26);
    	add(SEARCHLIGHTS27);
    	add(SEARCHLIGHTS28);
    	add(SEARCHLIGHTS29);
    	add(SEARCHLIGHTS30);
    	add(SEARCHLIGHTS31);
    	add(SEARCHLIGHTS32);
    	add(SEARCHLIGHTS33);
    	add(SEARCHLIGHTS34);
    	add(SEARCHLIGHTS35);
    	add(SEARCHLIGHTS36);
    	add(SEARCHLIGHTS37);
    	add(SEARCHLIGHTS38);
    	add(SEARCHLIGHTS39);
    	add(SEARCHLIGHTS40);
    	add(SEARCHLIGHTS41);
    	add(SEARCHLIGHTS42);
    	add(SEARCHLIGHTS43);
    	add(SEARCHLIGHTS44);
    	add(SEARCHLIGHTS45);
    	add(SEARCHLIGHTS46);
    	add(SEARCHLIGHTS47);
    	add(SEARCHLIGHTS48);
    	add(SEARCHLIGHTS49);
    	add(SEARCHLIGHTS50);
    }};
    public static final JSONArray SENDLIGHTS1= new JSONArray();
    public static final JSONArray SENDLIGHTS2= new JSONArray();
    public static final JSONArray SENDLIGHTS3= new JSONArray();
    public static final JSONArray SENDLIGHTS4= new JSONArray();
    public static final JSONArray SENDLIGHTS5= new JSONArray();
    public static final JSONArray SENDLIGHTS6= new JSONArray();
    public static final JSONArray SENDLIGHTS7= new JSONArray();
    public static final JSONArray SENDLIGHTS8= new JSONArray();
    public static final JSONArray SENDLIGHTS9= new JSONArray();
    public static final JSONArray SENDLIGHTS10= new JSONArray();
    public static final JSONArray SENDLIGHTS11= new JSONArray();
    public static final JSONArray SENDLIGHTS12= new JSONArray();
    public static final JSONArray SENDLIGHTS13= new JSONArray();
    public static final JSONArray SENDLIGHTS14= new JSONArray();
    public static final JSONArray SENDLIGHTS15= new JSONArray();
    public static final JSONArray SENDLIGHTS16= new JSONArray();
    public static final JSONArray SENDLIGHTS17= new JSONArray();
    public static final JSONArray SENDLIGHTS18= new JSONArray();
    public static final JSONArray SENDLIGHTS19= new JSONArray();
    public static final JSONArray SENDLIGHTS20= new JSONArray();
    public static final JSONArray SENDLIGHTS21= new JSONArray();
    public static final JSONArray SENDLIGHTS22= new JSONArray();
    public static final JSONArray SENDLIGHTS23= new JSONArray();
    public static final JSONArray SENDLIGHTS24= new JSONArray();
    public static final JSONArray SENDLIGHTS25= new JSONArray();
    public static final JSONArray SENDLIGHTS26= new JSONArray();
    public static final JSONArray SENDLIGHTS27= new JSONArray();
    public static final JSONArray SENDLIGHTS28= new JSONArray();
    public static final JSONArray SENDLIGHTS29= new JSONArray();
    public static final JSONArray SENDLIGHTS30= new JSONArray();
    public static final JSONArray SENDLIGHTS31= new JSONArray();
    public static final JSONArray SENDLIGHTS32= new JSONArray();
    public static final JSONArray SENDLIGHTS33= new JSONArray();
    public static final JSONArray SENDLIGHTS34= new JSONArray();
    public static final JSONArray SENDLIGHTS35= new JSONArray();
    public static final JSONArray SENDLIGHTS36= new JSONArray();
    public static final JSONArray SENDLIGHTS37= new JSONArray();
    public static final JSONArray SENDLIGHTS38= new JSONArray();
    public static final JSONArray SENDLIGHTS39= new JSONArray();
    public static final JSONArray SENDLIGHTS40= new JSONArray();
    public static final JSONArray SENDLIGHTS41= new JSONArray();
    public static final JSONArray SENDLIGHTS42= new JSONArray();
    public static final JSONArray SENDLIGHTS43= new JSONArray();
    public static final JSONArray SENDLIGHTS44= new JSONArray();
    public static final JSONArray SENDLIGHTS45= new JSONArray();
    public static final JSONArray SENDLIGHTS46= new JSONArray();
    public static final JSONArray SENDLIGHTS47= new JSONArray();
    public static final JSONArray SENDLIGHTS48= new JSONArray();
    public static final JSONArray SENDLIGHTS49= new JSONArray();
    public static final JSONArray SENDLIGHTS50= new JSONArray();
    public static final ArrayList<JSONArray> SENDLIGHTS = new ArrayList<JSONArray>() {//要在多个线程中执行的安灯灯号
		private static final long serialVersionUID = -5821990640849911856L;

	{    	add(SENDLIGHTS1);
			add(SENDLIGHTS2);
			add(SENDLIGHTS3);
			add(SENDLIGHTS4);
			add(SENDLIGHTS5);
			add(SENDLIGHTS6);
			add(SENDLIGHTS7);
			add(SENDLIGHTS8);
			add(SENDLIGHTS9);
			add(SENDLIGHTS10);
			add(SENDLIGHTS11);
			add(SENDLIGHTS12);
			add(SENDLIGHTS13);
			add(SENDLIGHTS14);
			add(SENDLIGHTS15);
			add(SENDLIGHTS16);
			add(SENDLIGHTS17);
			add(SENDLIGHTS18);
			add(SENDLIGHTS19);
			add(SENDLIGHTS20);
			add(SENDLIGHTS21);
			add(SENDLIGHTS22);
			add(SENDLIGHTS23);
			add(SENDLIGHTS24);
			add(SENDLIGHTS25);
			add(SENDLIGHTS26);
			add(SENDLIGHTS27);
			add(SENDLIGHTS28);
			add(SENDLIGHTS29);
			add(SENDLIGHTS30);
			add(SENDLIGHTS31);
			add(SENDLIGHTS32);
			add(SENDLIGHTS33);
			add(SENDLIGHTS34);
			add(SENDLIGHTS35);
			add(SENDLIGHTS36);
			add(SENDLIGHTS37);
			add(SENDLIGHTS38);
			add(SENDLIGHTS39);
			add(SENDLIGHTS40);
			add(SENDLIGHTS41);
			add(SENDLIGHTS42);
			add(SENDLIGHTS43);
			add(SENDLIGHTS44);
			add(SENDLIGHTS45);
			add(SENDLIGHTS46);
			add(SENDLIGHTS47);
			add(SENDLIGHTS48);
			add(SENDLIGHTS49);
			add(SENDLIGHTS50);
		}};//要在多个线程中执行的灯号
    
		public static final ArrayList<String> CHECKLIGHTS1= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS2= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS3= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS4= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS5= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS6= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS7= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS8= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS9= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS10= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS11= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS12= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS13= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS14= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS15= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS16= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS17= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS18= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS19= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS20= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS21= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS22= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS23= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS24= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS25= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS26= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS27= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS28= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS29= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS30= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS31= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS32= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS33= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS34= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS35= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS36= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS37= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS38= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS39= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS40= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS41= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS42= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS43= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS44= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS45= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS46= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS47= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS48= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS49= Lists.newArrayList();
	    public static final ArrayList<String> CHECKLIGHTS50= Lists.newArrayList();
	    public static final ArrayList<ArrayList<String>> CHECKLIGHTS = new ArrayList<ArrayList<String>>() {//要在多个线程中执行的检查灯位灯号
			private static final long serialVersionUID = -5262559023978696523L;

		{
	    	add(CHECKLIGHTS1);
	    	add(CHECKLIGHTS2);
	    	add(CHECKLIGHTS3);
	    	add(CHECKLIGHTS4);
	    	add(CHECKLIGHTS5);
	    	add(CHECKLIGHTS6);
	    	add(CHECKLIGHTS7);
	    	add(CHECKLIGHTS8);
	    	add(CHECKLIGHTS9);
	    	add(CHECKLIGHTS10);
	    	add(CHECKLIGHTS11);
	    	add(CHECKLIGHTS12);
	    	add(CHECKLIGHTS13);
	    	add(CHECKLIGHTS14);
	    	add(CHECKLIGHTS15);
	    	add(CHECKLIGHTS16);
	    	add(CHECKLIGHTS17);
	    	add(CHECKLIGHTS18);
	    	add(CHECKLIGHTS19);
	    	add(CHECKLIGHTS20);
	    	add(CHECKLIGHTS21);
	    	add(CHECKLIGHTS22);
	    	add(CHECKLIGHTS23);
	    	add(CHECKLIGHTS24);
	    	add(CHECKLIGHTS25);
	    	add(CHECKLIGHTS26);
	    	add(CHECKLIGHTS27);
	    	add(CHECKLIGHTS28);
	    	add(CHECKLIGHTS29);
	    	add(CHECKLIGHTS30);
	    	add(CHECKLIGHTS31);
	    	add(CHECKLIGHTS32);
	    	add(CHECKLIGHTS33);
	    	add(CHECKLIGHTS34);
	    	add(CHECKLIGHTS35);
	    	add(CHECKLIGHTS36);
	    	add(CHECKLIGHTS37);
	    	add(CHECKLIGHTS38);
	    	add(CHECKLIGHTS39);
	    	add(CHECKLIGHTS40);
	    	add(CHECKLIGHTS41);
	    	add(CHECKLIGHTS42);
	    	add(CHECKLIGHTS43);
	    	add(CHECKLIGHTS44);
	    	add(CHECKLIGHTS45);
	    	add(CHECKLIGHTS46);
	    	add(CHECKLIGHTS47);
	    	add(CHECKLIGHTS48);
	    	add(CHECKLIGHTS49);
	    	add(CHECKLIGHTS50);
	    }};//要在多个线程中执行的灯号
    
	    public static final ArrayList<String> CLEARLIGHTS1= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS2= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS3= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS4= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS5= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS6= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS7= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS8= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS9= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS10= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS11= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS12= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS13= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS14= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS15= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS16= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS17= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS18= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS19= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS20= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS21= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS22= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS23= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS24= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS25= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS26= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS27= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS28= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS29= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS30= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS31= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS32= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS33= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS34= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS35= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS36= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS37= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS38= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS39= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS40= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS41= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS42= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS43= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS44= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS45= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS46= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS47= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS48= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS49= Lists.newArrayList();
	    public static final ArrayList<String> CLEARLIGHTS50= Lists.newArrayList();
	    public static final ArrayList<ArrayList<String>> CLEARLIGHTS = new ArrayList<ArrayList<String>>() {//要在多个线程中执行的清灯灯号
			private static final long serialVersionUID = -4966416018903414893L;

		{
	    	add(CLEARLIGHTS1);
	    	add(CLEARLIGHTS2);
	    	add(CLEARLIGHTS3);
	    	add(CLEARLIGHTS4);
	    	add(CLEARLIGHTS5);
	    	add(CLEARLIGHTS6);
	    	add(CLEARLIGHTS7);
	    	add(CLEARLIGHTS8);
	    	add(CLEARLIGHTS9);
	    	add(CLEARLIGHTS10);
	    	add(CLEARLIGHTS11);
	    	add(CLEARLIGHTS12);
	    	add(CLEARLIGHTS13);
	    	add(CLEARLIGHTS14);
	    	add(CLEARLIGHTS15);
	    	add(CLEARLIGHTS16);
	    	add(CLEARLIGHTS17);
	    	add(CLEARLIGHTS18);
	    	add(CLEARLIGHTS19);
	    	add(CLEARLIGHTS20);
	    	add(CLEARLIGHTS21);
	    	add(CLEARLIGHTS22);
	    	add(CLEARLIGHTS23);
	    	add(CLEARLIGHTS24);
	    	add(CLEARLIGHTS25);
	    	add(CLEARLIGHTS26);
	    	add(CLEARLIGHTS27);
	    	add(CLEARLIGHTS28);
	    	add(CLEARLIGHTS29);
	    	add(CLEARLIGHTS30);
	    	add(CLEARLIGHTS31);
	    	add(CLEARLIGHTS32);
	    	add(CLEARLIGHTS33);
	    	add(CLEARLIGHTS34);
	    	add(CLEARLIGHTS35);
	    	add(CLEARLIGHTS36);
	    	add(CLEARLIGHTS37);
	    	add(CLEARLIGHTS38);
	    	add(CLEARLIGHTS39);
	    	add(CLEARLIGHTS40);
	    	add(CLEARLIGHTS41);
	    	add(CLEARLIGHTS42);
	    	add(CLEARLIGHTS43);
	    	add(CLEARLIGHTS44);
	    	add(CLEARLIGHTS45);
	    	add(CLEARLIGHTS46);
	    	add(CLEARLIGHTS47);
	    	add(CLEARLIGHTS48);
	    	add(CLEARLIGHTS49);
	    	add(CLEARLIGHTS50);
	    }};//要在多个线程中执行的灯号
    

    

    public static final Map<String,String> areas = new HashMap<String,String>(){ 
		private static final long serialVersionUID = -2374327532971696078L;

	{
    	put("01","1层");//地宫一屋0101010101
    	put("02","2层");//地宫二层
    	put("03","3层");//地面一层
    	put("04","4层");//地面二层
    	put("05","5层");//地面三层
    	put("06","6层");//地面四层
    	put("07","7层");//地面五层
    	put("08","8层");//地面六层
    	put("09","9层");//地面七层
    	put("10","10层");//地面八层
    	put("11","11层");//地面九层
    	put("12","12层");//地面十层
    	put("13","13层");//地面十一层
    	put("14","14层");//地面十二层
    }};
//    private static final String sourceLightno = "";

    /**
     * 根据当前行列找出来当前灯号
     *
     * @param row
     * @param column
     * @return
     */
    public static String findLightno(Integer area, Integer seat, Integer pillar, Integer row, Integer column) {
        Integer nos = row * column;
        String prelightno = preConditionParams(nos, row, column, area, seat, pillar);
        StringBuffer layer = new StringBuffer(row.toString());
        if (row < 10)
            layer.append(0).reverse();
        StringBuffer col = new StringBuffer(column.toString());
        if (column < 10)
            col.append(0).reverse();
        String lightno = prelightno + layer.toString() + col.toString();
        return lightno;
    }

    /**
     * 获取每面墙最中心的灯位号作为源灯位号
     *
     * @param row
     * @param column
     * @return
     */
    public static String getSourceLightno(Integer area, Integer seat, Integer pillar, Integer row, Integer column) {
        Integer nos = row * column;
        String prelightno = preConditionParams(nos, row, column, area, seat, pillar);
        Integer midrow = (row + 1) / 2;
        Integer midcol = (column + 1) / 2;
        StringBuffer layer = new StringBuffer(midrow.toString());
        if (midrow < 10)
            layer.append(0).reverse();
        StringBuffer col = new StringBuffer(midcol.toString());
        if (midcol < 10)
            col.append(0).reverse();
        String lightno = prelightno + layer.toString() + col.toString();
        return lightno;
    }

    /**
     * 生成每面墙的灯位号优先队列
     *
     * @param row
     * @param column
     * @return
     */
    public static Queue<Vertex> genLightQueue(Integer area, Integer seat, Integer pillar, Integer row, Integer column) {
        Queue<Vertex> lightnos = new PriorityQueue<Vertex>();
        Integer nos = row * column;
        String prelightno = preConditionParams(nos, row, column, area, seat, pillar);
        for (int i = 1; i <= row; i++) {
            StringBuffer layer = new StringBuffer();
            if (i < 10)
                layer.append("0").append(i);
            else
                layer.append(i);
            for (int j = 1; j <= column; j++) {
                StringBuffer col = new StringBuffer();
                if (j < 10)
                    col.append("0").append(j);
                else
                    col.append(j);
                String lightno = area + seat + pillar + layer.toString() + col.toString();
                Vertex vertex = new Vertex(lightno);
//                  System.out.println(lightno);
                lightnos.add(vertex);
            }
        }
//        System.out.println(lightnos.size());
        return lightnos;
    }

    /**
     * 生成每面墙的灯位号矩阵
     *
     * @param row
     * @param column
     * @return
     */
    public static List<List<Vertex>> genLightMatrix(Integer area, Integer seat, Integer pillar, Integer row, Integer column) {
        List<List<Vertex>> lightVertexs = new ArrayList<List<Vertex>>(Lists.newArrayList());
        Integer nos = row * column;
        String prelightno = preConditionParams(nos, row, column, area, seat, pillar);
        for (Integer i = 1; i <= row; i++) {
            StringBuffer layer = new StringBuffer(i.toString());
            layer = layer.append(0).reverse();
            List<Vertex> rowVertex = Lists.newArrayList();
            for (Integer j = 1; j <= column; j++) {
                StringBuffer col = new StringBuffer(j.toString());
                if (j < 10)
                    col = col.append(0).reverse();
                StringBuffer lightno = new StringBuffer();
                lightno.append(prelightno);
                lightno.append(layer.toString());
                lightno.append(col.toString());
                Vertex vertex = new Vertex(lightno.toString());
//                System.out.println(lightno);
                rowVertex.add(vertex);
            }
            lightVertexs.add(rowVertex);
        }
//        System.out.println(lightnos.size());
        return lightVertexs;
    }

    /**
     * 生成每面墙所有灯号
     *
     * @param row
     * @param column
     * @return
     */
    public static List<String> genLightno(Integer area, Integer seat, Integer pillar, Integer row, Integer column) {
        List<String> lightnos = Lists.newArrayList();
        Integer nos = row * column;
        String prelightno = preConditionParams(nos, row, column, area, seat, pillar);
        for (Integer i = 1; i <= row; i++) {
            StringBuffer layer = new StringBuffer(i.toString());
            if (i < 10)
                layer = layer.append(0).reverse();
            for (Integer j = 1; j <= column; j++) {
                StringBuffer col = new StringBuffer(j.toString());
                if (j < 10)
                    col = col.append(0).reverse();
                StringBuffer lightno = new StringBuffer();
                lightno.append(prelightno);
                lightno.append(layer.toString());
                lightno.append(col.toString());
                lightnos.add(lightno.toString());
            }
        }
//        System.out.println(lightnos.size());
        return lightnos;
    }
    /**
     * 生成每面墙所有灯号
     *
     * @param row
     * @param column
     * @return
     */
    public static List<String> genLightno1(Integer area, Integer seat, Integer pillar, Integer row, Integer column) {
        List<String> lightnos = Lists.newArrayList();
        Integer nos = row * column;
        String prelightno = preConditionParams(nos, row, column, area, seat, pillar);
        for (Integer i = 1; i <= row; i++) {
            StringBuffer layer = new StringBuffer(i.toString());
            if (i < 10)
                layer = layer.append(0).reverse();
            for (Integer j = 1; j <= column; j++) {
                StringBuffer col = new StringBuffer(j.toString());
                if (j < 10)
                    col = col.append(0).reverse();
                StringBuffer lightno = new StringBuffer();
                lightno.append(prelightno);
                lightno.append(layer.toString());
                lightno.append(col.toString());
//                  System.out.println(lightno);
                lightnos.add(layer.toString()+","+col.toString()+","+lightno.toString());
            }
        }
//        System.out.println(lightnos.size());
        return lightnos;
    }
    /**
     * 参数条件验证
     *
     * @param nos
     * @param row
     * @param column
     * @param area
     * @param seat
     * @param pillar
     * @return
     */
    private static String preConditionParams(Integer nos, Integer row, Integer column, Integer area, Integer seat, Integer pillar) {
        if (nos > MAXLAYER * MAXCOL || row > MAXLAYER || column > MAXCOL)
            throw new RuntimeException("灯位层位超出每面墙的可承载的层位数或数量！");
        StringBuffer areas = new StringBuffer(Integer.toString(Integer.parseInt(area.toString())));
        if (area < 10)
            areas = areas.append(0).reverse();
        StringBuffer seats = new StringBuffer(Integer.toString(Integer.parseInt(seat.toString())));
        if (seat < 10)
            seats = seats.append(0).reverse();
        StringBuffer pillars = new StringBuffer(Integer.toString(Integer.parseInt(pillar.toString())));
        if (pillar < 10)
            pillars = pillars.append(0).reverse();
        String prelightno = areas.toString() + seats.toString() + pillars.toString();
        if (prelightno.length() != 6)
            throw new RuntimeException("灯位编号位数生成不正确！");
        return prelightno;
    }
    /******************************地宫一层start**************************************************/
  	public static final Map<String,String> pillarMap1 = new HashMap<String,String>(){ 
		private static final long serialVersionUID = -2374327532971696078L;
	{
  		put("01","5,58");
  		put("02","5,58");
  		put("03","5,24");
  		put("04","5,36");
  		put("05","5,10");
  		put("06","5,68");
  		put("07","5,22");
  		put("08","5,60");
  		put("09","5,5");
 	    put("10","5,22");
 	    put("11","5,12");
	    put("12","5,9");
	 	put("13","5,25");
	 	put("14","5,18");
	 	put("15","5,41");
  	}};
     /******************************地宫一层end**************************************************/
    /******************************地宫二层start**************************************************/
  	public static final Map<String,String> pillarMap2 = new HashMap<String,String>(){ 
		private static final long serialVersionUID = -6544764704037670405L;
	{
  		put("01","5,58");
  		put("02","5,58");
  		put("03","5,24");
  		put("04","5,36");
  		put("05","5,10");
  		put("06","5,68");
  		put("07","5,22");
  		put("08","5,60");
  		put("09","5,5");
 	    put("10","5,22");
 	    put("11","5,12");
	    put("12","5,9");
	 	put("13","5,25");
	 	put("14","5,18");
	 	put("15","5,41");
  	}};
		 /******************************地宫一层end**************************************************/
		 /******************************地面一层start**************************************************/
  	public static final Map<String,String> pillarMap3 = new HashMap<String,String>(){ 
		private static final long serialVersionUID = -7043001462868428535L;

	{
  		put("01","7,6");
//  		put("01","5,58");
  		put("02","7,4");
  		put("03","4,4");
  		put("04","7,40");
  		put("05","7,4");
  		put("06","7,4");
  		put("07","7,40");
  		put("08","7,4");
  		put("09","7,5");
 	    put("10","7,14");
 	    put("11","7,6");
	    put("12","7,4");
	 	put("13","4,4");
	 	put("14","7,40");
	 	put("15","7,4");
		put("16","7,4");
  		put("17","7,6");
  		put("18","7,6");
  		put("19","7,4");
  		put("20","4,4");
  		put("21","7,40");
  		put("22","7,4");
  		put("23","7,4");
  		put("24","7,6");
 	    put("25","7,25");
 	    put("26","7,25");
	    put("27","7,25");
	 	put("28","7,8");
	 	put("29","7,22");
	 	put("30","7,22");
	 	put("31","7,22");
  	}};
	 /******************************地面一层end**************************************************/
    /******************************地面二层start**************************************************/
  	public static final Map<String,String> pillarMap4 = new HashMap<String,String>(){ 
		private static final long serialVersionUID = 5609863623034192259L;

	{
  		put("01","6,49");
  		put("02","6,4");
  		put("03","6,4");
  		put("04","6,42");
  		put("05","6,4");
  		put("06","6,4");
  		put("07","6,42");
  		put("08","6,4");
  		put("09","4,4");
 	    put("10","6,14");
 	    put("11","6,6");
	    put("12","6,4");
	 	put("13","6,4");
	 	put("14","6,40");
	 	put("15","4,4");
		put("16","6,4");
  		put("17","6,6");
  		put("18","6,6");
  		put("19","6,4");
  		put("20","6,4");
  		put("21","6,40");
  		put("22","6,4");
  		put("23","6,4");
  		put("24","6,6");
 	    put("25","6,25");
 	    put("26","6,25");
  	}};
     /******************************地面二层end**************************************************/
    /******************************地面三层start**************************************************/
  	public static final Map<String,String> pillarMap5 = new HashMap<String,String>(){ 
		private static final long serialVersionUID = -7280998581505739379L;
	{
  		put("01","6,6");
  		put("02","6,37");
  		put("03","6,9");
  		put("04","6,9");
  		put("05","6,37");
  		put("06","6,9");
  		put("07","6,9");
  		put("08","6,37");
  		put("09","6,37");
  		put("10","6,17");
  		put("11","6,8");
  	}};
     /******************************地面三层end**************************************************/
	 /******************************地面四层start**************************************************/
  	public static final Map<String,String> pillarMap6 = new HashMap<String,String>(){ 
		private static final long serialVersionUID = -7321342531390560376L;

	{
  		put("01","6,21");
  		put("02","6,37");
  		put("03","6,37");
  		put("04","6,37");
  		put("05","6,37");
  		put("06","6,37");
  		put("07","6,37");
  		put("08","6,17");
  		put("09","6,8");
  	}};
	/******************************地面六层end**************************************************/
	 /******************************地面七层start**************************************************/
  	public static final Map<String,String> pillarMap7 = new HashMap<String,String>(){ 
		private static final long serialVersionUID = -5484683010679966689L;

	{
  		put("01","11,25");
  		put("02","11,4");
  		put("03","11,4");
  		put("04","11,25");
  		put("05","11,4");
  		put("06","11,4");
  		put("07","11,25");
  		put("08","11,25");
  		put("09","11,17");
  		put("10","11,8");
  	}};
	/******************************地面五层end**************************************************/
    /******************************地面六层start**************************************************/
  	public static final Map<String,String> pillarMap8 = new HashMap<String,String>(){ 
		private static final long serialVersionUID = -4631244027596643738L;

	{
  		put("01","11,25");
  		put("02","11,4");
  		put("03","11,4");
  		put("04","11,25");
  		put("05","11,4");
  		put("06","11,4");
  		put("07","11,25");
  		put("08","11,25");
  		put("09","11,17");
  		put("10","11,8");
  	}};
     /******************************地面六层end**************************************************/
    /******************************地面二层start**************************************************/
  	public static final Map<String,String> pillarMap9 = new HashMap<String,String>(){ 
		private static final long serialVersionUID = -7006390410680653893L;

	{
  		put("01","11,25");
  		put("02","11,4");
  		put("03","11,4");
  		put("04","11,25");
  		put("05","11,4");
  		put("06","11,4");
  		put("07","11,25");
  		put("08","11,25");
  		put("09","11,17");
  		put("10","11,8");
  	}};
     /******************************地面七层end**************************************************/
    /******************************地面八层start**************************************************/
  	public static final Map<String,String> pillarMap10 = new HashMap<String,String>(){ 
		private static final long serialVersionUID = -7541428639615706271L;

	{
  		put("01","11,25");
  		put("02","11,4");
  		put("03","11,4");
  		put("04","11,25");
  		put("05","11,4");
  		put("06","11,4");
  		put("07","11,25");
  		put("08","11,25");
  		put("09","11,17");
  		put("10","11,8");
  	}};
     /******************************地面八层end**************************************************/
    /******************************地面九层start**************************************************/
  	public static final Map<String,String> pillarMap11 = new HashMap<String,String>(){ 
		private static final long serialVersionUID = -9091659439673956469L;

	{
  		put("01","11,25");
  		put("02","11,4");
  		put("03","11,4");
  		put("04","11,25");
  		put("05","11,4");
  		put("06","11,4");
  		put("07","11,25");
  		put("08","11,25");
  		put("09","11,17");
  		put("10","11,8");
  	}};
     /******************************地面九层end**************************************************/
    /******************************地面十层start**************************************************/
  	public static final Map<String,String> pillarMap12 = new HashMap<String,String>(){ 
		private static final long serialVersionUID = 8722397758581123812L;

	{
  		put("01","11,25");
  		put("02","11,4");
  		put("03","11,4");
  		put("04","11,25");
  		put("05","11,4");
  		put("06","11,4");
  		put("07","11,25");
  		put("08","11,25");
  		put("09","11,17");
  		put("10","11,8");
  	}};
     /******************************地面十层end**************************************************/
    /******************************地面十一层start**************************************************/
  	public static final Map<String,String> pillarMap13 = new HashMap<String,String>(){ 
		private static final long serialVersionUID = 7070136373912965593L;

	{
  		put("01","11,25");
  		put("02","11,4");
  		put("03","11,4");
  		put("04","11,25");
  		put("05","11,4");
  		put("06","11,4");
  		put("07","11,25");
  		put("08","11,25");
  		put("09","11,17");
  		put("10","11,8");
  	}};
     /******************************地面十一层end**************************************************/
    /******************************地面十二层start**************************************************/
  	public static final Map<String,String> pillarMap14 = new HashMap<String,String>(){ 
		private static final long serialVersionUID = 7054522957559251064L;

	{
  		put("01","11,25");
  		put("02","11,4");
  		put("03","11,4");
  		put("04","11,25");
  		put("05","11,4");
  		put("06","11,4");
  		put("07","11,25");
  		put("08","11,25");
  		put("09","11,17");
  		put("10","11,8");
  	}};
     /******************************地面十二层end**************************************************/
	 private static String lightnos(List<Integer> layerArray3,List<Integer> bitsArray3) {
		 List<String> result = Lists.newArrayList();
        for(int i=1;i<=31;i++) {
        	  List<String> list = genLightno(3, 1, i, layerArray3.get(i-1), bitsArray3.get(i-1));
        	  result.addAll(list);
        }
        String st = result.toString().replaceAll(" ", "");
        st= st.replace("[", "");
        st= st.replace("]", "");
        System.out.println(st);
        return st;
	 }
	 
	 
	public void insTableData(String area) {
//		String area = "1";
	/*	String areasql = "select id from pa_production_area wher name=?";
		Integer areaId =  jdbcTemplate.queryForObject(areasql,new Object[] {areas.get(area)},Integer.class);
		for(int i=0;i<pillarArray3.size();i++) {
			String sql="insert into pa_production_postion(name,positon_no,area_id,state,createtime,updatetime) values(?,?,?,1,now(),now())";
			jdbcTemplate.update(sql, new Object[] {pillarArray3.get(i)+"墙",AREA03+SEAT+pillarArray3.get(i),areaId}, Integer.class);
		}*/
		/*String areasql = "select id from pa_production_area wher name=?";
		Integer areaId =  jdbcTemplate.queryForObject(areasql,new Object[] {areas.get(area)},Integer.class);
		for(int i=0;i<pillarArray2.size();i++) {
			String sql="insert into pa_production_postion(name,positon_no,area_id,state,createtime,updatetime) values(?,?,?,1,now(),now())";
			jdbcTemplate.update(sql, new Object[] {pillarArray2.get(i)+"墙",AREA02+SEAT+pillarArray2.get(i),areaId}, Integer.class);
		}*/
	}
	
	
    public static void main(String[] args) {
    	new LightUtil().insTableData("1");
 
    	String msg="JesusIsChrist";
//        List<List<String>> result = Lists.newArrayList();
//    	 List<String> result = Lists.newArrayList();
//    	 JSONArray array = new JSONArray();
//    	 int j=1;
//        for(int i=1;i<=31;i++) {
//        	  List<String> list = null;//genLightno(3, 1, i, layer.get(i-1), bits.get(i-1));
//        	  result.addAll(list);
////        	  for (String str : list) {
////                  JSONObject obj = new JSONObject();
////                  obj.put("obj", msg+j );
////                  obj.put("lightno", str);
////                  array.add(obj);
////                  j++;
////              }
//        	 
//        }
//        String st = result.toString().replaceAll(" ", "");
//        st= st.replace("[", "");
//        st= st.replace("]", "");
//        System.out.println(st);
//        System.out.println(array.toString());
//        System.out.println("#########################################"+result.size());
//       List<List<Vertex>> list = genLightMatrix(3,1,7,7,40);
       /* List<String> list = genLightno(3, 1, 1, 7, 40);
       System.out.println(list.toString().replaceAll(" ",""));
        JSONArray array = new JSONArray();
        String msg = "炎武";
        int i = 1;
        for (String str : list) {
            JSONObject obj = new JSONObject();
            obj.put("obj", msg + i);
            obj.put("lightno", str);
            array.add(obj);
            i++;
        }*/
      /*  for(List<Vertex> str:list){
            System.out.println(str.toString());
            for(Vertex v:str){
                System.out.println(JSONObject.toJSONString(v));
            }
            i++;
        }*/
      //  System.out.println(array.toJSONString());
        // String no = getSourceLightno(7, 40);
        //  System.out.println(no);

    }


}
